<style scoped lang="stylus" type="text/stylus">
  .approval-Page {
    height : 100%
    .edit-header {
      position : fixed
      top : 0
      height : 60px
      line-height : 60px;
      padding-left : 40px;
      font-size : 18px;
      background-color : #4c4c4c
      .route-title {
        color : #fff
        cursor : pointer
      }
      .page-name {
        color : #7f7f7f
      }
    }
    .approval-Page-ps {
      position : relative
      height : 100%
      padding : 40px 0
      .approval-items {
        width : 480px
        margin : 0 auto
        padding : 20px
        margin-bottom : 20px
        background-color : #e5e5e5
        .name {
          margin-bottom : 20px
          text-align : center
          font-size : 18px
        }
        .info {
          font-size : 14px
          p{
            margin-bottom 15px
            &:last-child{
              margin-bottom 0
            }
            .mobile{
              margin-left 30px
            }
          }
        }
        .img {
          padding : 20px 0
          .file {
            padding : 10px 0
            a {
              font-size : 12px
            }
          }
        }
        .footer {
          text-align : right
        }
      }
    }
  }
</style>

<template>
  <div class="approval-Page">
    <div class="edit-header">
      <span @click="GoBack()" class="route-title">设置</span>
      <span class="page-name">&nbsp;/&nbsp;企业审核</span>
    </div>
    <VuePerfectScrollbar class="approval-Page-ps">
      <div class="approval-items" v-for="item in approvalArr" :key="item.id">
        <p class="name">{{item.name}}</p>
        <div class="info">
          <p class="number">企业统一社会信用代码：{{item.orgCode}}</p>
          <p class="number" v-if='item.chairman'>
            <span class="linkman">董事长姓名：{{item.chairman}}</span>
            <span class="mobile">联系方式：{{item.chairmanPhone}}</span>
          </p>
          <p class="number" v-if='item.generalManager'>
            <span class="linkman">总经理姓名：{{item.generalManager}}</span>
            <span class="mobile">联系方式：{{item.generalManagerPhone}}</span>
          </p>
          <p class="number" v-if='item.legalPersonName'>
            <span class="linkman">法人姓名：{{item.legalPersonName}}</span>
            <span class="mobile">联系方式： {{item.legalPersonPhone}}</span>
          </p>
        </div>
        <div class="img">
          <ul>
            <li class="file" v-for="(files,filesIndex) in item.files" :key="filesIndex">
              <a target="_blank" :href="files.filePath">{{files.fileName}}</a>
            </li>
          </ul>
        </div>
        <div class="footer">
          <Poptip
            transfer
            confirm
            title="是否确定驳回该注册申请？"
            @on-ok="sub(item.id,'reject')">
            <Button type="error">拒绝</Button>
          </Poptip>
          <Poptip
            transfer
            confirm
            title="是否确定同意该注册申请？"
            @on-ok="sub(item.id,'approve')">
            <Button type="success">批准</Button>
          </Poptip>
          <!--<Button @click="sub(item.id,'reject')" type="error">拒绝</Button>-->
          <!--<Button @click="sub(item.id,'approve')" type="success">批准</Button>-->
        </div>
      </div>
    </VuePerfectScrollbar>
  </div>
</template>

<script type="text/ecmascript-6">

  export default {
    name      : 'Approval',
    data() {
      return {
        approvalArr: []
      }
    },
    computed  : {},
    methods   : {
      // 获取审核列表
      getList() {
        this.ajaxData({
          type: 'get',
          url : '/company/unaudit'
        }, (res, all) => {
          if (all.code == 0) {
            this.approvalArr = res
          }
        })
      },
      urlFormat(str) {
        let s   = '123,123';
        let arr = s.split(',')
        return arr
      },
      downFile(url) {
        this.ajaxData({
          type: 'get',
          url : '/filecommon/downloadFile',
          data: {
            filePath: url
          }
        }, res => {

        })
      },
      /**
       * reject 拒绝
       * approve 批准
       * @param id
       * @param action
       */
      sub(id, action) {
        this.ajaxData({
          type: 'post',
          url : `/company/${id}/${action}`
        }, (res, all) => {
          if (all.code == 0) {
            this.getList()
          }
        })
      }
    },
    created() {
      this.urlFormat()
      this.getList()
    }
  }
</script>
